package ch.zbw.timeline.domain;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

import lombok.Data;

/**
 * Domain class for a year config
 */
@Entity
@SequenceGenerator(name = "id_year_config", initialValue = 1, allocationSize = 1)
@Table(name = "year_config")
@Data
public class YearConfig implements Serializable {

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "id_year_config", nullable = false)
	private int id;

	@Column(name = "year", nullable = false)
	private int year;

	@Column(name = "period_length", nullable = true)
	private Integer periodLength;

	@Column(name = "weekly_working_hours", nullable = true)
	private Double weeklyWorkingHours;

	@Column(name = "flexitime_percent", nullable = true)
	private Double flexitimePercent;

	@Column(name = "number_of_vacation_days", nullable = true)
	private Integer numberOfVacationDay;

	@Column(name = "easter_sunday", nullable = true)
	private Date easterSunday;

	@Transient
	public List<Holiday> holidays;

	public YearConfig() {
	}

	public YearConfig(int year, Integer periodLength,
			Double weeklyWorkingHours, Double flexitimePercent,
			Integer numberOfVacationDay, Date easterSunday) {
		this.year = year;
		this.periodLength = periodLength;
		this.weeklyWorkingHours = weeklyWorkingHours;
		this.flexitimePercent = flexitimePercent;
		this.numberOfVacationDay = numberOfVacationDay;
		this.easterSunday = easterSunday;
	}
}
